<script>
 $(document).ready(function() {
   var refreshId = setInterval(function() {
      $("#chat_form_div").load("<?php echo Yii::app()->controller->createUrl('/user/chat/'); ?>");
   }, 5000);
   $.ajaxSetup({ cache: false });
});
</script>

<div class="clr"></div>
		<div class="mod">
    	<div class="mod-tit"><a href="#">Trao đổi nhanh</a></div>
    	<div class="mod-cont comt">
        	<div class="comt-in">
                <?php $form=$this->beginWidget('CActiveForm', array(
                    'id'=>'chat-form',
                    //'enableClientValidation'=>true,
                    'enableAjaxValidation'=>false,
                    'htmlOptions' => array(
                        'name'=>'chat',
                        //'enctype' => 'multipart/form-data',
                        'onsubmit'=>"return false;",
                        "onkeypress"=>"if (event.keyCode == 13) {
                            ".CHtml::ajax(array(
                                'url'=>Yii::app()->controller->createUrl('/user/chat/chat'),
                                'type'=>'post',
                                'update'=>'#chat_form_div',
                                'data'=>"js:$('#chat-form').serialize()"
                                ))
                            ."
                            document.getElementById('Chat_content').value =  '';
                        }",
                        )
                )); ?>
                <input size="60" maxlength="200" name="Chat[content]" id="Chat_content" type="text">
                <?php $this->endWidget();?>

            </div>
            <div class="example">(VD: Tôi muốn thành công với ước mơ của mình)</div>
            <div id="chat_form_div">
            <?php foreach ($model as $key ):?>
            <div class="comt-one" id ="comt<?php echo $key->id;?>"><img src="<?php echo Yii::app()->request->baseUrl; ?>/themes/bjoco/images/ava.gif" align="left" />
                <?php 
                    echo $key->content;

             ?></div>
        <?php endforeach; ?>
            </div>
           <span><a href="#">Xem tất cả</a></span> 
        </div>
        <div class="clr"></div>
    	</div>
